package zhoufu.sz.sanxiao_check.models;

import android.databinding.Bindable;
import android.support.v4.util.TimeUtils;
import android.webkit.URLUtil;

import java.io.Serializable;
import java.sql.Time;
import java.util.Calendar;
import java.util.List;

import zhoufu.sz.sanxiao_check.BR;

import zhoufu.sz.sanxiao_check.BR;

/**
 * User:RCP
 * email:ruancaipu@gmail.com
 * Date:2016/7/30
 */
public class CheckItemModel extends BaseModel<CheckItemModel> implements Serializable {

    /**
     * SID : 2874
     * AddTime : 2016-05-31 10:39:30
     * Remark :
     * Remark2 : http://120.31.131.190:8080/DlGridManageSystem/201604/31/1464662303409.png
     * Examine_Type : 2
     * UserID : 677
     * Complete_Time : 2016-05-31 00:00:00
     * Overdue : 1
     * Evidence : http://120.31.131.190:8080/DlGridManageSystem/201604/31/1464662296870.jpg
     */

    private String Name;
    private String Address;
    private String Place_No;

    private int SID;
    private String AddTime;
    private String Remark;
    private String Remark2;
    private int Examine_Type;
    private int UserID;
    private String Complete_Time;
    private int Overdue;
    private String Evidence;
    private List<DangerModel> Dangers;

    public CheckItemModel() {
        Calendar calendar = Calendar.getInstance();


        int mYear = calendar.get(Calendar.YEAR);
        int mMonth = calendar.get(Calendar.MONTH) + 1;
        int mDay = calendar.get(Calendar.DAY_OF_MONTH);

        if (mMonth > 12) {
            mYear += 1;
            mMonth = 1;
        }

        String date = mYear + "/" + mMonth + "/" + mDay;
        setComplete_Time(date);
    }

    public List<DangerModel> getDangers() {
        return Dangers;
    }

    public String getPlace_No() {
        return Place_No;
    }

    public void setPlace_No(String place_No) {
        Place_No = place_No;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getAddress() {
        return Address;
    }

    public void setAddress(String address) {
        Address = address;
    }


    public void setDangers(List<DangerModel> dangers) {
        Dangers = dangers;
    }

    public int getSID() {
        return SID;
    }

    public void setSID(int SID) {
        this.SID = SID;
    }

    public String getAddTime() {
        return AddTime;
    }

    public void setAddTime(String AddTime) {
        this.AddTime = AddTime;
    }

    @Bindable
    public String getRemark() {
        return Remark;
    }

    private String localSign;
    private String localRemark;
    private String localRemark2;

    public void setRemark(String Remark) {
        this.Remark = Remark;
        if (!URLUtil.isHttpUrl(Remark))
            setLocalRemark(Remark);
        notifyPropertyChanged(BR.remark);
    }

    @Bindable
    public String getRemark2() {
        return Remark2;
    }

    public void setRemark2(String Remark2) {
        this.Remark2 = Remark2;
        if (!URLUtil.isHttpUrl(Remark2))
            setLocalRemark2(Remark2);
        notifyPropertyChanged(BR.remark2);
    }

    public String getLocalSign() {
        return localSign;
    }

    public void setLocalSign(String localSign) {
        this.localSign = localSign;
    }

    public String getLocalRemark() {
        return localRemark;
    }

    public void setLocalRemark(String localRemark) {
        this.localRemark = localRemark;
    }

    public String getLocalRemark2() {
        return localRemark2;
    }

    public void setLocalRemark2(String localRemark2) {
        this.localRemark2 = localRemark2;
    }

    public int getExamine_Type() {
        return Examine_Type;
    }

    public void setExamine_Type(int Examine_Type) {
        this.Examine_Type = Examine_Type;
    }

    public int getUserID() {
        return UserID;
    }

    public void setUserID(int UserID) {
        this.UserID = UserID;
    }

    @Bindable
    public String getComplete_Time() {
        return Complete_Time;
    }

    public void setComplete_Time(String Complete_Time) {
        this.Complete_Time = Complete_Time;
        notifyPropertyChanged(BR.complete_Time);
    }

    public int getOverdue() {
        return Overdue;
    }

    public void setOverdue(int Overdue) {
        this.Overdue = Overdue;
    }

    @Bindable
    public String getEvidence() {
        return Evidence;
    }

    public void setEvidence(String Evidence) {
        this.Evidence = Evidence;
        if (!URLUtil.isHttpUrl(Evidence)) {
            setLocalSign(Evidence);
        }
        notifyPropertyChanged(BR.evidence);
    }

}
